package com.cmccgz.udacs_landlord_webapp.main.housemanager.manager;

import com.cmccgz.udacs_landlord_webapp.bean.HouseManagerBean;
import com.cmccgz.udacs_landlord_webapp.data.HouseManagerDataSource;
import com.cmccgz.udacs_landlord_webapp.data.HouseManagerRepository;

import java.util.List;

/**
 * @author: Huang
 * @Descripion:
 * @date 2017/6/5 10:31
 */

public class HouseManagerPresenter implements HouseManagerContract.Presenter {

    private HouseManagerContract.View mView;
    private HouseManagerRepository mRepository;

    public HouseManagerPresenter(HouseManagerRepository houseManagerRepository, HouseManagerContract.View fragment) {
        this.mRepository = houseManagerRepository;
        this.mView = fragment;
        mView.setPresenter(this);
    }

    @Override
    public void initData() {
        mRepository.getFunctionList(new HouseManagerDataSource.FunctionListCallback() {
            @Override
            public void onFunctionListLoaded(List<HouseManagerBean> list) {
                mView.setData(list);
            }

            @Override
            public void onLoadedFailed(String msg) {

            }
        });
    }

    @Override
    public void start() {
    }
}
